Class Label extends Box
var color;
var stroke;
var fontSize;
var align="left";
var middle=false;
var bold=false;
var lineH;
var letterSpacing=0;
var text;
var html;
var selectable=false;
var multi=false;
var ellipsis=false;
var indent=false;
var textShadow;
function Label(text,color,fontSize){
	this.enabled=false;
	if(fontSize==null) fontSize=int(24*GAid.designW/640);
	if(this.__class==Label){
		if(is(Array,text)){
			color=text[1];
			fontSize=text[2]||fontSize;
			text=text[0];
		}
		this.color=color||"#000";
		this.fontSize=fontSize;
		this.text=text||"";
	}
	else{
		this.color="#000";
		this.fontSize=fontSize;
		this.text="";
	}
	this.lineH=(G.os==1?1:1.2)*this.fontSize;
	this.div.style.cssText="color:"+G.toColor(this.color)+";font-size:"+fontSize+"px;white-space:nowrap;"
		+"pointer-events:none;"+G.toCssKey("text-size-adjust")+":100%;line-height:"+this.lineH+"px";
	this.div.innerText=this.text;
}
function setSize(w,h){
	Box.proto.setSize.call(this,w,h);
	if(!this.multi&&!this.mask){
		this.div.style.minWidth=this.div.style.width;
		this.div.style.width="auto";
	}
	if(this.middle) this.setMiddle(true);
}
public function setText(v){
	if(!is(String,v)) v+="";
	this.text=v;
	this.div.innerText=v;
	if(this.middle) this.setMiddle(true);
	G.renderIos=true;
}
public function setSelectable(v){
	this.selectable=v;
	this.div.style[G.toCssKey("UserSelect")]=v?"text":"none";
}
public function setHtml(v){
	if(!is(String,v)) v+="";
	this.html=v;
	this.div.innerHTML=v;
	if(this.middle) this.setMiddle(true);
	G.renderIos=true;
}
public function setMiddle(v){
	this.middle=v;
	var top=0;
	if(v){
		var h=this.div.clientHeight;
		var lineH=this.lineH;
		if(lineH<10) lineH*=this.fontSize;
		top=(lineH-h)/2;
	}
	this.div.style.marginTop=top+"px";
}
public function setColor(v){
	this.color=v;
	this.div.style.color=G.toColor(v);
}
public function setStroke(v){
	this.stroke=v;
	this.div.style[G.toCssKey("TextStroke")]=!v?"none":"1px "+G.toColor(v);
}
public function setFontSize(v){
	this.fontSize=v;
	this.div.style.fontSize=v+"px";
}
public function setAlign(v){
	if(v=="c") v="center";
	if(v=="r") v="right";
	this.align=v;
	this.div.style.textAlign=v;
}
public function setBold(v){
	this.bold=v;
	this.div.style.fontWeight=v?"bold":"normal";
}
public function setLineH(v){
	if(v<10) v*=this.fontSize;
	this.lineH=v;
	this.div.style.lineHeight=v+"px";
}
public function setLetterSpacing(v){
	this.letterSpacing=v;
	this.div.style.letterSpacing=v+"px";
}
public function setMulti(v){
	this.multi=v;
	this.setLineH(v?1.5:(G.os==1?1:1.2));
	this.div.style.whiteSpace=!v?"nowrap":"normal";
}
public function setIndent(v){
	this.indent=v;
	this.div.style.textIndent=v?"2em":"";
}
public function setEllipsis(v){
	this.ellipsis=v;
	this.mask=true;
	this.div.style.overflow="hidden";
	this.div.style.whiteSpace="nowrap";
	this.div.style.textOverflow=v?"ellipsis":"clip";
}
public function setTextShadow(v){
	this.textShadow=v;
	var css="none";
	if(is(Array,v)){
		css=v[0]+"px "+v[1]+"px "+v[2]+"px "+G.toColor(v[3]);
	}
	else{
		css="5px 5px 5px "+G.toColor(v);
	}
	this.div.style.textShadow=css;
}